﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;

namespace DatabaseEntegreItri
{
    public class VisualVars : DependencyObject
    {
        private static ControlTemplate templateControl;//Default değeri için
        private static ControlTemplate TemplateControl
        {
            get
            {
                try
                {
                    object tt = null;
                    ResourceDictionary myDictionary = Application.LoadComponent(new Uri("/DatabaseEntegreItri;component/Resources/GridStyles.xaml", UriKind.RelativeOrAbsolute)) as ResourceDictionary;
                    object temp = null;
                    foreach (String str in myDictionary.Keys)
                    {
                        temp = myDictionary[str];
                        if (temp is ControlTemplate)
                        {
                            tt = temp;                            
                            if ("SampleTemplate1".Equals(str))                            
                            {
                                break;
                            }
                        }
                    }
                    return (ControlTemplate)tt;
                }
                catch { }

                return null;

            }
            set { templateControl = value; }
        }

        public static DependencyProperty templateWindowProperty =
            DependencyProperty.RegisterAttached("templateWindow", typeof(ControlTemplate), typeof(VisualVars), new PropertyMetadata(TemplateControl));
        public ControlTemplate templateWindow
        {
            get { return (ControlTemplate)GetValue(templateWindowProperty); }
            set
            {
                SetValue(templateWindowProperty, value);
            }
        }

        public static DependencyProperty baseStilControlProperty =
            DependencyProperty.RegisterAttached("baseStilControl", typeof(Style), typeof(VisualVars), new PropertyMetadata(null));
        public Style baseStilControl
        {
            get { 
                return (Style)GetValue(baseStilControlProperty);
            }
            set
            {
                SetValue(baseStilControlProperty, value);
            }
        }

    }
}
